function Map(hookSize) {
	this.capacity = hookSize;
	this.values = new Array(hookSize);
	this.size = 0;
}

Map.prototype.hash = function(key) {
	var keystr = "" + key;
	var sum = 0;
	for(var i=0;i<keystr.length;i++) {
		sum = sum + keystr.charCodeAt(i);
	}
	return sum % this.capacity;
}

Map.prototype.put = function(key,value){
	var hashCode = this.hash(key);
	var valueList = this.values[hashCode];
	if(valueList == null) {
		valueList = new Array();
		this.values[hashCode] = valueList;
	}
	for(var i=0;i<valueList.length;i++) {
		var entry = valueList[i];
		if(entry[0] == key) {
			entry[1] = value;
			return;
		}
	}
	valueList[valueList.length] = [key,value];
	this.size = this.size + 1;
}

Map.prototype.get = function(key) {
	var hashCode = this.hash(key);
	var valueList = this.values[hashCode];
	if(valueList != null) {
		for(var i=0;i<valueList.length;i++) {
			if(valueList[i][0] == key) {
				return valueList[i][1];
			}
		}
	}
	return null;
}

Map.prototype.list = function(func) {
	for(var i in this.values) {
		for(var k in this.values[i]) {
			func(this.values[i][k][0],this.values[i][k][1]);
		}
	}
}

Map.prototype.remove = function(element) {
	var hashCode = this.hash(key);
	var valueList = this.values[hashCode];
	if(valueList != null) {
		for(var i=0;i<valueList.length;i++) {
			if(valueList[i][0] == key) {
				var value = valueList[i][1];
				valuesList.splice(i,1);
				return value;
			}
		}
	}
	return null;
}